package com.example.smartcity.ui.smartCity

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.example.smartcity.logic.Repository
import com.example.smartcity.logic.model.Slideshow

class SmartCityViewModel : ViewModel() {
    // 轮播图数据
    /**
     * TODO viewModel 轮播图
     */
    private val slideshowData = MutableLiveData<Map<String, Int>>()

    val placeList = ArrayList<Slideshow.Rows>()

    val placeLiveData = Transformations.switchMap(slideshowData){ query ->
        Repository.getSlideshow(query)
    }

    fun slideshow(map: Map<String, Int>){
        slideshowData.value = map
    }
}